package com.itheima.Method;

public class Method05 {
    public static void main(String[] args) {
        int arr[] = new int[]{19, 22, 33, 64, 88, 8};
        int[] maxmin = getMax(arr);
        System.out.println(maxmin[0]);
        System.out.println(maxmin[1]);
    }

    public static int[] getMax(int arr[]) {
        int max = arr[0];
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
            if (arr[i] < min) {
                min = arr[i];
            }
        }
        int[] maxAndMin = {min, max};
        return maxAndMin;
    }
}
